import { wasm_edge_detection_sobel } from 'zlyt-wasm';
export class EdgeDetection {
  static sobel(
    data: Uint8Array,
    extension: string,
    type: string,
    threshold: number
  ): Promise<Blob> {
    const result = new Promise<Blob>((resolve, reject) => {
      try {
        const image = wasm_edge_detection_sobel(data, extension, threshold);
        const resultImg = new Blob([image.buffer], { type });
        resolve(resultImg);
      } catch (e) {
        reject(`gauss filter error:${e}`);
      }
    });
    return result;
  }
}
